import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LawyerInfoVo, LawyerInfoForm, LawyerInfoQuery } from '@/api/lawyerinfo/types';

/**
 * 查询律师信息列表
 * @param query
 * @returns {*}
 */

export const listLawyerInfo = (query?: LawyerInfoQuery): AxiosPromise<LawyerInfoVo[]> => {
  return request({
    url: '/lawyer/lawyerInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询律师信息详细
 * @param id
 */
export const getLawyerInfo = (id: string | number): AxiosPromise<LawyerInfoVo> => {
  return request({
    url: '/lawyer/lawyerInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增律师信息
 * @param data
 */
export const addLawyerInfo = (data: LawyerInfoForm) => {
  return request({
    url: '/lawyer/lawyerInfo/saveLawyerInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改律师信息
 * @param data
 */
export const updateLawyerInfo = (data: LawyerInfoForm) => {
  return request({
    url: '/lawyer/lawyerInfo/updateLawyerInfo',
    method: 'post',
    data: data
  });
};

/**
 * 删除律师信息
 * @param id
 */
export const delLawyerInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lawyer/lawyerInfo/removeLawyerInfo/' + id,
    method: 'delete'
  });
};
